package com.sanyang.pda.adapter;

import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.sanyang.pda.bean.PickingDeliveryBean;
import com.wangshen.base.ui.mvp.base.adapter.BaseAdapter;
import com.wangshen.projectbase.R;

import java.util.List;

public class PickingDeliveryAdapter extends BaseAdapter<PickingDeliveryBean> {
    public PickingDeliveryAdapter(int layoutResId, @Nullable List<PickingDeliveryBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, PickingDeliveryBean item) {
        super.convert(helper, item);
        helper.setText(R.id.tv_title,item.getArticleName());
        helper.setText(R.id.tv_amount,item.getStockNum());
        helper.setText(R.id.tv_specification,item.getSpec());
        helper.setText(R.id.tv_batch,item.getBatchNo());
        helper.setText(R.id.tv_admire_date,item.getExpiringTime());
        helper.setText(R.id.tv_product_time,item.getProductTime());
        CheckBox checkBox=helper.getView(R.id.cb_open);
        LinearLayout linearLayout=helper.getView(R.id.ll_open);
        checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if (isChecked){
                    linearLayout.setVisibility(View.VISIBLE);
                }else {
                    linearLayout.setVisibility(View.GONE);
                }
            }
        });
    }
}
